#ifndef QTWORDFETCH_H
#define QTWORDFETCH_H

#include <QProcess>
#include <QtSql>
#include <QtWidgets/QMainWindow>
#include "ui_qtwordfetch.h"

class QtWordFetch : public QMainWindow
{
    Q_OBJECT

public:
    QtWordFetch(QWidget *parent = 0);
    ~QtWordFetch();

    bool createConnection();
    bool createDbData(QMap<QString, int>& data);
    void initializeModel(QSqlTableModel * model);

private:
    void Transform(QString input, QString output, QString lang);
    void StatisticsWord(QString filePath, QMap<QString, int> & result);

    void stringModify(QString & str);

    bool stringFilter(QString str);

    int GetStringsFromFile(QString fileName);

protected slots:
    void onfinished(int exitCode, QProcess::ExitStatus exitStatus);
    void onerrorOccurred(QProcess::ProcessError error);
    void onstarted();

    void on_pushButton_inputData_clicked();
    void on_pushButton_Statistics_clicked();
    void on_pushButton_outPut_clicked();
private:
    Ui::QtWordFetchClass ui;
    QProcess _process;
    QMap<QString,int> wordMap;
};

#endif // QTWORDFETCH_H
